<?php

namespace app\site\controller;

use think\admin\Controller;

/**
 * App管理
 * Class App
 * @package app\site\controller
 * @author Leo.lei <346991581@qq.com>
 * @date 2019/12/20 17:56
 */
class App extends Controller
{
    /**
     * App配置
     * @auth true  # 表示需要验证权限
     * @menu true  # 在菜单编辑的节点可选项
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\DbException
     * @throws \think\db\exception\ModelNotFoundException
     */
    public function index()
    {
        $this->_applyFormToken();
        if ($this->request->isGet()) {
            $this->title = 'App配置';
            $this->fetch();
        } else {
            foreach ($this->request->post() as $name => $value) {
                sysconf($name, $value);
            }
            $this->success('更新完成！');
        }
    }
}